package suanfa;

public class Hanoitower {
    public static void hanoitower(int num,char a,char b,char c){
        if(num==1){
            System.out.println("第一个盘从"+a+"->"+c);
        }else{//盘>=2
            hanoitower(num-1,a,c,b);
            System.out.println("第"+num+"个盘从"+a+"->"+c);
            hanoitower(num-1,b,a,c);
        }
    }

    public static void main(String[] args) {
        char a='a';
        char b='a';
        char c='c';

        hanoitower(4,a,b,c);
    }
}
